<?php echo $header; ?>
<section class="main">
	<section class="blog_post">
    	<div class="container">
        	<div class="row">
            	<div class="span9">
                	<article class="post post-full">
                        <div class="post post-full">
                            <div class="box">
                                <div class="box-header">
                                    <h2> <?php echo $heading_title; ?> </h2>
                                    <ul class="post-meta"> 
                                        <li> <i class="icon-user"></i> &nbsp; <?php echo $viewed?></li>
                                        <li> <i class="icon-calendar"></i> &nbsp; <?php echo $date_added?></li>
                                        <li> <i class="icon-comment-alt"></i> &nbsp; <?php echo $total_comments?></li>
                                    </ul>
                                </div>
                                <div class="box-content">
                                    <?php echo $description?>
                                </div>
                            </div><!-- box -->
                        </div>
                    </article>
                    <section class="post-comments">
                    	<div class="box">
                        	<div class="box-header">
                            	<h3><?php echo $tab_comment; ?></h3>
                            </div>
                            <div class="box-content">
                            	<div id="comment"></div>
                            </div>
                        </div>
                    </section>
                    <section class="post-comment-form">
                    	<div class="box">
                        	<div class="box-header">
                            	<h3><?php echo $text_write; ?></h3>
                            </div>
                        	<div id="post-comment">
                                <b><?php echo $entry_name; ?></b><br />
                                <input type="text" name="name" value="<?php echo $customer_name; ?>" />
                                <br /><br />
                                <b><?php echo $entry_email; ?></b><br />
                                <input type="text" name="email" value="<?php echo $customer_email; ?>" />
                                <br /><br />
                                <b><?php echo $entry_comment; ?></b>
                                <textarea name="text" cols="40" rows="8" style="width: 98%;"></textarea><br />
                                <br />    
                                <b><?php echo $entry_captcha; ?></b><br />
                                <input id="captcha" type="text" name="captcha" value="" />
                                <img src="index.php?route=tool/captcha" alt="" id="captcha" /><br />
                                <br /><br /> 
                                <div class="left" style="clear:both"><a id="button-comment" class="btn btn-primary btn-small"><span><?php echo $button_send; ?></span> <i class="icon-comment-alt"></i></a></div>    
                            </div>
                        </div>
                    </section>
                </div>
                <div class="span3">
                    <?php echo $blogs_category?>
                    <?php echo $column_right?>
                </div>
            </div>
        </div>
    </section>
</section>
<?php echo $footer; ?>
<?php if ($allow_comment) { ?>
<script type="text/javascript">
$('#comment .pagination a').live('click', function() {
	$('#comment').slideUp('slow');
		
	$('#comment').load(this.href);
	
	$('#comment').slideDown('slow');
	
	return false;
});			

$('#comment').load('index.php?route=blogs/blogs/comment&blogs_id=<?php echo $blogs_id; ?>');

$('#button-comment').bind('click', function() {
	$.ajax({
		type: 'POST',
		url: 'index.php?route=blogs/blogs/write&blogs_id=<?php echo $blogs_id; ?>&approved=<?php echo $approved; ?>',
		dataType: 'json',
		data: 'name=' + encodeURIComponent($('input[name=\'name\']').val()) + '&email=' + encodeURIComponent($('input[name=\'email\']').val()) + '&text=' + encodeURIComponent($('textarea[name=\'text\']').val()) + '&captcha=' + encodeURIComponent($('input[name=\'captcha\']').val()),
		beforeSend: function() {
			$('.success, .warning').remove();
			$('#button-comment').attr('disabled', true);
			$('#comment-title').after('<div class="attention"><img src="catalog/view/theme/default/image/loading.gif" alt="" /> <?php echo $text_wait; ?></div>');
		},
		complete: function() {
			$('#button-comment').attr('disabled', false);
			$('.attention').remove();
		},
		success: function(data) {
			if (data.error) {
				$('#comment-title').after('<div class="warning">' + data.error + '</div>');
			}
			
			if (data.success) {
				$('#comment-title').after('<div class="success">' + data.success + '</div>');
								
				$('input[name=\'name\']').val('');
				$('input[name=\'email\']').val('');
				$('textarea[name=\'text\']').val('');
				$('input[name=\'captcha\']').val('');
			}
		}
	});
});
</script>
<script type="text/javascript">
jQuery(document).ready(function($) {
	$(".scroll").click(function(event){		
		event.preventDefault();
		$('html,body').animate({scrollTop:$(this.hash).offset().top}, 500);
	});
});
</script>
<?php } ?>